<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="/jsp/taglib.jsp"%>
<%@ page import="com.biz.conf.Global" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>主页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <%--<!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->--%>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/animate.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/style.min862f.css?v=4.1.0" rel="stylesheet">
	 <!-- Sweet Alert -->
    <link href="${pageContext.request.contextPath}/resources/plugins/h+/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">

	 <div id="wrapper">
         <!--左侧导航开始-->
         <nav class="navbar-default navbar-static-side" role="navigation">
             <div class="nav-close"><i class="fa fa-times-circle"></i>
             </div>
             <div class="sidebar-collapse">
                 <ul class="nav" id="side-menu">
                     <li class="nav-header">
                         <div class="dropdown profile-element">
<c:choose>
                             <c:when test="${userinfo.headUrl!=null&&userinfo.headUrl!=''&&userinfo.headUrl!=undefined}">
                                 <span><img width="64px" alt="image" class="img-circle" src="<%=Global.getConfig("OSSURL")%>/${userinfo.headUrl}" /></span>

                             </c:when>
                             <c:otherwise>
                                 <span><img width="64px" alt="image" class="img-circle" src="${pageContext.request.contextPath}/resources/plugins/h+/img/profile_small.jpg" /></span>

                             </c:otherwise>
</c:choose>

                             <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">

                               <span class="block m-t-xs">
                                   <strong class="font-bold">
                                       <shiro:guest>
                                           欢迎游客访问
                                       </shiro:guest>
                                       <shiro:user>
                                           <shiro:principal defaultValue="游客"/>
                                       </shiro:user>


                                   </strong></span>
                                <span class="text-muted text-xs block">${userinfo.person_name}<b class="caret"></b></span>
                                </span>

                             </a>
                             <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                 <li><a data-toggle="modal" class="J_menuItem" href="javascript:void(0)" onclick="modalopen()">修改密码</a>
                                 </li>
                                 <li><a class="J_menuItem" href="javascript:void(0)" id="btn_modifyUser">账号信息</a>
                                 </li>
                                 <%--<li><a class="J_menuItem" href="contacts.html">联系我们</a>
                                 </li>
                                 <li><a class="J_menuItem" href="mailbox.html">信箱</a>
                                 </li>--%>
                                 <li class="divider"></li>
                                 <li><a id="a_left_logout" href="javascript:void(0)">安全退出</a>
                                 </li>
                             </ul>
                         </div>
                         <div class="logo-element">五峰
                         </div>
                     </li>


                 </ul>
             </div>
         </nav>
         <!--左侧导航结束-->

         <!--右上侧部分开始-->
         <div id="page-wrapper" class="gray-bg dashbard-1">
             <div class="row border-bottom">
                 <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                     <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="javascript:void(0)"><i class="fa fa-bars"></i> </a>
                         <form role="search" class="navbar-form-custom" method="post" action="${pageContext.request.contextPath}/home/toSearchResults.ac">
                             <div class="form-group" style="display: none">
                                 <input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">
                             </div>
                         </form>
                     </div>
                     <%--<ul class="nav navbar-top-links navbar-right">
                         <li class="dropdown hidden-xs">
                             <a class="right-sidebar-toggle" aria-expanded="false">
                                 <i class="fa fa-tasks"></i> 主题
                             </a>
                         </li>
                     </ul>--%>
                 </nav>
             </div>
             <div class="row content-tabs">
                 <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
                 </button>
                 <nav class="page-tabs J_menuTabs">
                     <div class="page-tabs-content">
                         <a href="javascript:" class="active J_menuTab" data-id="index_v1.html">首页</a>
                     </div>
                 </nav>
                 <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
                 </button>
                 <div class="btn-group roll-nav roll-right">
                     <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>

                     </button>
                     <ul role="menu" class="dropdown-menu dropdown-menu-right">
                         <li class="J_tabShowActive"><a>定位当前选项卡</a>
                         </li>
                         <li class="divider"></li>
                         <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                         </li>
                         <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                         </li>
                     </ul>
                 </div>
                 <a id="a_top_logout" href="javascript:void(0)" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
             </div>

             <div class="row J_mainContent" id="content-main">
                 <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${pageContext.request.contextPath}/home/toHome.ac" frameborder="0" data-id="index_v1.html" seamless></iframe>
             </div>

             <div class="footer" align="center">
                 <div class="pull-center">&copy; 2015-2016 <a href="http://www.iishang.com" target="_blank">${company} - ${version}</a>
                 </div>
             </div>
         </div>
         <!--右上侧部分结束 -->

         <!--右侧边栏开始-->
         <div id="right-sidebar">
             <div class="sidebar-container">

                 <ul class="nav nav-tabs navs-3">

                     <li class="active">
                         <a data-toggle="tab" href="#tab-1">
                             <i class="fa fa-gear"></i> 主题
                         </a>
                     </li>
                     <li class=""><a data-toggle="tab" href="#tab-2">
                         通知
                     </a>
                     </li>
                     <li><a data-toggle="tab" href="#tab-3">
                         项目进度
                     </a>
                     </li>
                 </ul>

                 <div class="tab-content">
                     <div id="tab-1" class="tab-pane active">
                         <div class="sidebar-title">
                             <h3> <i class="fa fa-comments-o"></i> 主题设置</h3>
                             <small><i class="fa fa-tim"></i> 你可以从这里选择和预览主题的布局和样式，这些设置会被保存在本地，下次打开的时候会直接应用这些设置。</small>
                         </div>
                         <div class="skin-setttings">
                             <div class="title">主题设置</div>
                             <div class="setings-item">
                                 <span>收起左侧菜单</span>
                                 <div class="switch">
                                     <div class="onoffswitch">
                                         <input type="checkbox" name="collapsemenu" class="onoffswitch-checkbox" id="collapsemenu">
                                         <label class="onoffswitch-label" for="collapsemenu">
                                             <span class="onoffswitch-inner"></span>
                                             <span class="onoffswitch-switch"></span>
                                         </label>
                                     </div>
                                 </div>
                             </div>
                             <div class="setings-item">
                                 <span>固定顶部</span>

                                 <div class="switch">
                                     <div class="onoffswitch">
                                         <input type="checkbox" name="fixednavbar" class="onoffswitch-checkbox" id="fixednavbar">
                                         <label class="onoffswitch-label" for="fixednavbar">
                                             <span class="onoffswitch-inner"></span>
                                             <span class="onoffswitch-switch"></span>
                                         </label>
                                     </div>
                                 </div>
                             </div>
                             <div class="setings-item">
                                <span>
                        固定宽度
                    </span>

                                 <div class="switch">
                                     <div class="onoffswitch">
                                         <input type="checkbox" name="boxedlayout" class="onoffswitch-checkbox" id="boxedlayout">
                                         <label class="onoffswitch-label" for="boxedlayout">
                                             <span class="onoffswitch-inner"></span>
                                             <span class="onoffswitch-switch"></span>
                                         </label>
                                     </div>
                                 </div>
                             </div>
                             <div class="title">皮肤选择</div>
                             <div class="setings-item default-skin nb">
                                <span class="skin-name ">
                         <a href="#" class="s-skin-0">
                             默认皮肤
                         </a>
                    </span>
                             </div>
                             <div class="setings-item blue-skin nb">
                                <span class="skin-name ">
                        <a href="#" class="s-skin-1">
                            蓝色主题
                        </a>
                    </span>
                             </div>
                             <div class="setings-item yellow-skin nb">
                                <span class="skin-name ">
                        <a href="#" class="s-skin-3">
                            黄色/紫色主题
                        </a>
                    </span>
                             </div>
                         </div>
                     </div>
                     <div id="tab-2" class="tab-pane">

                         <div class="sidebar-title">
                             <h3> <i class="fa fa-comments-o"></i> 最新通知</h3>
                             <small><i class="fa fa-tim"></i> 您当前有10条未读信息</small>
                         </div>


                     </div>
                     <div id="tab-3" class="tab-pane">

                         <div class="sidebar-title">
                             <h3> <i class="fa fa-cube"></i> 最新任务</h3>
                             <small><i class="fa fa-tim"></i> 您当前有14个任务，10个已完成</small>
                         </div>


                     </div>
                 </div>

             </div>
         </div>
         <!--右侧边栏结束-->

         <!--mini聊天窗口开始-->
         <!--mini聊天窗口结束-->

         <!-- 对话框图标结束 -->

     </div>
     <div class="modal inmodal" id="myModal4" style="width: 500px;left: 50%;margin-left: -250px;" tabindex="-1" role="dialog"  aria-hidden="true">
         <div class="modal-dialog" style=" width:500px;">
             <div class="modal-content animated fadeIn">
                 <div class="modal-header">
                     <span style="font-size:18px;">修改密码</span>
                     <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                 </div>
                 <div class="modal-body">
                     <div class="ibox-content">
                         <form class="form-horizontal m-t" onsubmit="return  false" name="">
                             <div class="form-group">
                                 <label class="col-sm-3 control-label">原密码：</label>
                                 <div class="col-sm-9">
                                     <input id="oldPwd" maxlength="15" type="password" placeholder="原密码" class="form-control" />
                                 </div>
                             </div>
                             <div class="form-group">
                                 <label class="col-sm-3 control-label">新密码：</label>
                                 <div class="col-sm-9">
                                     <input id="newPwd" maxlength="15" type="password" placeholder="新密码"  class="form-control" />
                                 </div>
                             </div>
                             <div class="form-group">
                                 <label class="col-sm-3 control-label">确认密码：</label>
                                 <div class="col-sm-9">
                                     <input id="newPwd2" maxlength="15" type="password" placeholder="确认密码"  class="form-control" />
                                 </div>
                             </div>
                         </form>
                     </div>
                 </div>
                 <div class="modal-footer">
                     <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                     <button type="button" class="btn btn-primary" onclick="closemodal();">保存</button>
                 </div>
             </div>
         </div>
     </div>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/jquery.min.js?v=2.1.4"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/layer2.4/layer.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/hplus.min.js?v=4.1.0"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/resources/plugins/h+/js/contabs.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/pace/pace.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/h+/js/plugins/sweetalert/sweetalert.min.js"></script>

     <script type="text/javascript">
         //新增
         $("#btn_modifyUser").click(function(){
             modifyUser();
         });
         /**新增按钮事件*/
         function modalopen(){
             $("#myModal4").modal('show');
         }
         function closemodal(){
             var oldPwd=$("#oldPwd").val();
             var newPwd=$("#newPwd").val();
             var newPwd2=$("#newPwd2").val();
             var flag=true;
             if(oldPwd==null||oldPwd==undefined||oldPwd==''){alert("请输入原密码！");flag= false;return false;}
             if(newPwd==null||newPwd==undefined||newPwd==''){alert("请输入新密码！");flag= false;return false;}
             if(newPwd2==null||newPwd2==undefined||newPwd2==''){alert("请输入确认密码！");flag= false;return false;}
             if(newPwd!=newPwd2){alert("新密码和确认密码输入不一致！");flag= false;return false;}
             if(flag){
                 $.ajax( {
                     url:'${pageContext.request.contextPath}/user/modifyPwd.ac',// 跳转到 action
                     data:{oldPwd:oldPwd,newPwd2:newPwd2},
                     type:'post',
                     dataType:'json',
                     success:function(data) {
                         if(data.isok==true){
                             alert(data.msg);
                             $("#myModal4").modal('hide');
                             $("#oldPwd").val("");
                             $("#newPwd").val("");
                             $("#newPwd2").val("");
                         }else{
                             alert(data.msg);
                         }
                     },
                     error : function() {
                         alert("操作失败！");
                     }
                 });
             }

         }
         $.ajax({
             url:'${pageContext.request.contextPath}/home/showLeftMenu.ac',
             type: 'post',
             async : false,
             success:function(data){
                 var json=eval(data);
                 var ul = createTree(json,0);
                 $("#side-menu").append(ul);
                 $("#side-menu").listview("refresh");
                 $("#side-menu").trigger("create");
             }
         });

         function createTree(data,id){
             if(data != null){
                 var ul='';
                 var zhuId=0;
                 var href='';
                 var datazd=data;
                 for (var i=0;i<data.length;i++)
                 {
                     if(data[i].pid == id){
                         ul+='<li>';
                         ul+='<a href="#"><i class="'+data[i].classIcon+'"></i><span class="nav-label">'+data[i].text+'</span><span class="fa arrow"></span></a>';


                         //子目录
                         zhuId=data[i].id;
                         ul+='<ul class="nav nav-second-level">';
                         for (var j=0;j<datazd.length;j++){
                             if(datazd[j].pid==zhuId) {
                                 href="${pageContext.request.contextPath}/"+datazd[j].href;
                                 ul += '<li><a class="J_menuItem" href=\"'+href+'\" >'+datazd[j].text+'</a></li>';
                             }
                         };


                         ul+='</ul>';
                         ul+='</li>';
                     }

                 }
                 return ul;
             }
             else{
                 return null;
             }
         }

         function modifyUser(){
             //自定页
             layer.open({
                 type: 2,
                 shift:4,//动画类型
                 moveType:1,
                 maxmin: true,
                 shadeClose: true, //开启遮罩关闭
                 area: ['800px', '530px'],
                 content: '${pageContext.request.contextPath}/user/toModifyUser.ac',
                 success: function(layero, index){
                     //layer.title("888888888", index);
                     var datas={"firstname":"555555"};
//                    var body = layer.getChildFrame('body', index);
                     //var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
//                    console.log(body.html()) //得到iframe页的body内容
                 },
                 cancel: function(index){
//                    alert(index);
                     return true;
                 }
             });
         }
     </script>
     <script type="text/javascript">
         //退出
         function logout(){
             swal({title: "亲 确定退出本系统吗?",
                         text: "确定后 您将到系统登录页面!",
                         type: "warning",
                         showCancelButton: true,
                         confirmButtonColor: "#DD6B55",
                         confirmButtonText: "确定",
                         cancelButtonText:"取消",
                         closeOnConfirm: false },
                     function(){
                         window.location.href="${ctx}/user/toLogin.ac";
                     });
         }

         $("#a_top_logout").click(function (){
             logout();
         });

         $("#a_left_logout").click(function(){
             logout();
         })
     </script>
</body>


</html>
